home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Textfiles / HackintoshBiblev1.3.sit / Hackintosh Bible v1.3.rsrc / TEXT_152.txt < prev    next >
Text File  |  1996-11-10  |  17KB  |  234 lines

  1. lowing the compare, we note that if they are not equal (i.e. OK button not hit) then it goes off somewhere.  The next instruction must be the one that executes after the user hits the OK button.  So set your breakpoint at the line that reads CLR.W  FDEC(A6) which is at address 5B4FA0 (this will vary) - and in fact you can see the asterisk in the listing denoting that I have done just that.  Now exit, enter your name and company and serial number (keep typing anything until the OK button lights up) and hit OK.  Now TMON breaks in again at the breakpoint.  Now we can begin the crack.
  2.  
  3. Determining how to implement the crack.
  4.  
  5. Before you continue, think about what the program must do at this point if it wants to validate your serial number (here it helps to have read Inside Mac on dialogs).  First the program must obtain a pointer to the dialog item #5 (the serial number field) and then it must obtain a pointer to the text contained in that item.  Knowing this, you can just scan down until you see a GetDItem trap followed closely by a GetIText trap.  After this last trap, the program can do its validation.  Here is that piece of code:
  6.  
  7. MOVE.L  A3,-(A7)
  8. _GetIText
  9. MOVE.L  A3,-(A7)
  10. JSR      ^$005B5670     
  11. TST.L      D0
  12. ADDQ.L  #4,A7
  13. BMI      ^$005B50C8     
  14. CMPI.L  #$00000005,D0
  15. BGT      ^$005B50C8     
  16. ADD.L      D0,D0
  17. MOVE.W  ^$005B500A(D0.L),D0    
  18. JMP      ^$005B5008(D0.W)    
  19.  
  20. We can note that A3 is the pointer that will point to the text after the trap.  Once A3 has the text, a subroutine is called and D0 is tested.  At this point, we cannot be sure whether the branch executes if the serial passed or failed, so we had better take a quick look at the code at address 5B50C8.  I am not going to show it here, but that code does some crap then calles ParamText and then a Dialog call so it is probably safe to guess that the branch above jumps to the error code. 
  21.  
  22. With this assumption in mind, what can we do about it?  An initial guess would be to just make that BMI either not execute or even better, make the BMI branch down to the ADD.L D0,D0.  Unfortunately, if you look at the last two lines, you can see that D0 not only determines whether the code branches to the error routine, but is then used for a JMP instruction so we had better take care of D0.  Let's take a quick look at that JSR up a few lines that sets D0 in the first place and remember, we are trying to figure out what D0 should be set to.  Also remember that the branch is a BMI meaning that the error occurs if the high bit of D0 is set.
  23.  
  24. 004B1508:'CODE'¬Æ$0003Δí$04C8+$096C LINK.W  A6,#$FF00
  25. 004B150C:'CODE'¬Æ$0003Δí$04C8+$0970 MOVEM.L A3/A4,-(A7)
  26. 004B1510:'CODE'¬Æ$0003Δí$04C8+$0974 LEA      `FF00(A6),A4
  27. 004B1514:'CODE'¬Æ$0003Δí$04C8+$0978 MOVEA.L $0008(A6),A3
  28. 004B1518:'CODE'¬Æ$0003Δí$04C8+$097C MOVEQ      #$00,D0
  29. 004B151A:'CODE'¬Æ$0003Δí$04C8+$097E MOVE.B  (A3),D0
  30. 004B151C:'CODE'¬Æ$0003Δí$04C8+$0980 MOVEQ      #$06,D1
  31. 004B151E:'CODE'¬Æ$0003Δí$04C8+$0982 CMP.L      D0,D1
  32. 004B1520:'CODE'¬Æ$0003Δí$04C8+$0984 BLE.S      ^$004B1526          ;'CODE'¬Æ$0003Δí$04C8+$98A
  33. 004B1522:'CODE'¬Æ$0003Δí$04C8+$0986 MOVEQ      #`FF,D0
  34. 004B1524:'CODE'¬Æ$0003Δí$04C8+$0988 BRA.S      ^$004B1592          ;'CODE'¬Æ$0003Δí$04C8+$9F6
  35. 004B1526:'CODE'¬Æ$0003Δí$04C8+$098A MOVEQ      #$00,D0
  36. 004B1528:'CODE'¬Æ$0003Δí$04C8+$098C MOVE.B  (A3),D0
  37. 004B152A:'CODE'¬Æ$0003Δí$04C8+$098E MOVEQ      #$28,D1         ;'('
  38. 004B152C:'CODE'¬Æ$0003Δí$04C8+$0990 CMP.L      D0,D1
  39. 004B152E:'CODE'¬Æ$0003Δí$04C8+$0992 BGE.S      ^$004B1534          ;'CODE'¬Æ$0003Δí$04C8+$998
  40. 004B1530:'CODE'¬Æ$0003Δí$04C8+$0994 MOVEQ      #`FF,D0
  41. 004B1532:'CODE'¬Æ$0003Δí$04C8+$0996 BRA.S      ^$004B1592          ;'CODE'¬Æ$0003Δí$04C8+$9F6
  42. 004B1534:'CODE'¬Æ$0003Δí$04C8+$0998 MOVE.L  A4,-(A7)
  43. 004B1536:'CODE'¬Æ$0003Δí$04C8+$099A PEA      $3802              ;$000037D8+$2A
  44. 004B153A:'CODE'¬Æ$0003Δí$04C8+$099E JSR      $1702(A5)
  45. 004B153E:'CODE'¬Æ$0003Δí$04C8+$09A2 MOVE.L  A4,-(A7)
  46. 004B1540:'CODE'¬Æ$0003Δí$04C8+$09A4 JSR      $0532(A5)
  47. 004B1544:'CODE'¬Æ$0003Δí$04C8+$09A8 MOVE.L  A3,-(A7)
  48. 004B1546:'CODE'¬Æ$0003Δí$04C8+$09AA MOVE.L  A4,-(A7)
  49. 004B1548:'CODE'¬Æ$0003Δí$04C8+$09AC JSR      $0392(A5)
  50. 004B154C:'CODE'¬Æ$0003Δí$04C8+$09B0 TST.L      D0
  51. 004B154E:'CODE'¬Æ$0003Δí$04C8+$09B2 LEA      $0014(A7),A7
  52. 004B1552:'CODE'¬Æ$0003Δí$04C8+$09B6 BEQ.S      ^$004B1558          ;'CODE'¬Æ$0003Δí$04C8+$9BC
  53. 004B1554:'CODE'¬Æ$0003Δí$04C8+$09B8 MOVEQ      #$05,D0
  54. 004B1556:'CODE'¬Æ$0003Δí$04C8+$09BA BRA.S      ^$004B1592          ;'CODE'¬Æ$0003Δí$04C8+$9F6
  55. 004B1558:'CODE'¬Æ$0003Δí$04C8+$09BC MOVE.B  $0001(A3),D0
  56. 004B155C:'CODE'¬Æ$0003Δí$04C8+$09C0 SUBI.B  #$30,D0
  57. 004B1560:'CODE'¬Æ$0003Δí$04C8+$09C4 BCS.S      ^$004B1590          ;'CODE'¬Æ$0003Δí$04C8+$9F4
  58. 004B1562:'CODE'¬Æ$0003Δí$04C8+$09C6 CMPI.B  #$02,D0
  59. 004B1566:'CODE'¬Æ$0003Δí$04C8+$09CA BHI.S      ^$004B1590          ;'CODE'¬Æ$0003Δí$04C8+$9F4
  60. 004B1568:'CODE'¬Æ$0003Δí$04C8+$09CC MOVEQ      #$00,D1
  61. 004B156A:'CODE'¬Æ$0003Δí$04C8+$09CE MOVE.B  D0,D1
  62. 004B156C:'CODE'¬Æ$0003Δí$04C8+$09D0 ADD.W      D1,D1
  63. 004B156E:'CODE'¬Æ$0003Δí$04C8+$09D2 MOVE.W  ^$004B1576(D1.W),D1         ;'CODE'¬Æ$0003Δí$04C8+$9DA
  64. 004B1572:'CODE'¬Æ$0003Δí$04C8+$09D6 JMP      ^$004B1574(D1.W)         ;'CODE'¬Æ$0003Δí$04C8+$9D8
  65.  
  66. There are no traps here to quickly tell us what is happening, but we can quickly look at the lines that affect D0.  Basically, there are a bunch of interspersed MOVEQ instructions putting various values into D0.  One of the values is $FF which (since the high bit of $FF is set - in fact, all the bits of $FF are set) must trigger the error in the previous procedure.  Other values include 5 and 0.  Right now, that is enough information to proceed with the previous procedure - if we need more in depth info, we can always come back.  So we have the following code again:
  67.  
  68. MOVE.L  A3,-(A7)
  69. JSR      ^$005B5670     
  70. TST.L      D0
  71. ADDQ.L  #4,A7
  72. BMI      ^$005B50C8     
  73. CMPI.L  #$00000005,D0
  74. BGT      ^$005B50C8     
  75. ADD.L      D0,D0
  76. MOVE.W  ^$005B500A(D0.L),D0    
  77. JMP      ^$005B5008(D0.W)    
  78.  
  79. Once again, we have an initial BMI which tells us that $FF won't work for D0.  We also have BGT after comparing D0 with 5 which branches to the error - so D0 must be between 0 and 5 (the other values we noted from the subroutine above).  At this point, I would (and did) simply try inserting values into D0.  I started with 5 and the program went into Demo mode - strike one.  Next I tried 1 and some other error occured.  Finally, I tried 0 and the program continued flawlessly.
  80.  
  81. So you are asking, how exactly might you go about inserting these values into D0?  Consider: once D0 is set to the proper value, the two branches become meaningless since they would not execute anyways (they only execute if there is an error).  This little tidbit tells us that we can safely overwrite these instructions with anything we like.  So we have several free bytes to put our own code into (don't panic yet - this is pretty straightforward) and all our code has to do is set D0 to 0 then proceed.  One quick note:  Never Never Ever modify code that affects the stack.  If you do, you can easily cause system errors later on down the road.  In the above code, this translates into not changing the ADDQ.L  #4,A7 (A7 is the stack pointer, remember?).  So what is the easiest way to put 0 into D0?  Use a MOVEQ instruction.  This is particularly nice because you probably do not know the machine hex code for instructions (like me).  But that subroutine we looked at before is chalk full of MOVEQ instructions.  If you look, a MOVEQ 0 #0,D0 translates into 70 00.  So far so good except that the stupid BMI is one of those 4 byte branches.  So we still have two bytes left that will be garbage since we just changed the first two.  This is an excellent candidate for a NOP instruction - a two byte instruction that does absolutely nothing.  The code for this (from the Cracker's Guide Part 1) is 4E 71.
  82.  
  83. So, open a dump window to the PC and find the BMI (I think it is 68 00 00 D4 or something like that).  Change the four values to 70 00 4E 71 and now the program loads D0 with the correct value and proceeds as if nothing had happened.  Now you have the crack, but you want to make a cracked / un-serialized copy right?  So, unstuff a fresh copy of the application, open it in Resedit, and open the proper CODE resource.  To find the ID #, look back at the TMON listing.  It says CODE 0003 plus some benutia about the File reference number and then +nnnn where nnnn is the offset from the beginning of the Code resource.  There is all you need.  Open CODE ID 3 and jump down to line 2E8 (since 2EE is our byte) and change the 68 00 00 D4 to 70 00 4E 71.  Now run it and enter anything you like for the serial number.
  84.  
  85. QuickFormat 7.01
  86.  
  87.  [due to burn-out, the final sections have not been written up]
  88.  
  89.      33E:                                 QUAL    CHECKFOR ; b# =508  s#3  =proc196
  90.  
  91.                                ;-refs -  3/INITPROG  
  92.  
  93.      33E: 4E56 FFE4      'NV..'  CHECKFOR LINK    A6,#-$1C
  94.      342: 48E7 0108      'H...'           MOVEM.L D7/A4,-(A7)
  95.      346: 594F           'YO'             SUBQ    #4,A7
  96.      348: 2F3C 6465 6D6F '/<demo'         PUSH.L  #'demo'
  97.      34E: 3F3C 0080      '?<..'           PUSH    #128
  98.      352: A81F           '..'             _Get1Resource ; (theType:ResType; ID:INTEGER):Handle 
  99.      354: 285F           '(_'             POP.L   A4
  100.      356: 200C           ' .'             MOVE.L  A4,D0
  101.      358: 6656           30003B0          BNE.S   lih_2
  102.      35A: 594F           'YO'             SUBQ    #4,A7
  103.      35C: 7004           'p.'             MOVEQ   #4,D0
  104.      35E: 2F00           '/.'             PUSH.L  D0
  105.      360: 4EAD 0082      10005EA          JSR     NewHandle(A5)
  106.      364: 285F           '(_'             POP.L   A4
  107.      366: 2F0C           '/.'             PUSH.L  A4
  108.      368: 4EAD 0092      1000614          JSR     HLock(A5)
  109.      36C: 2054           ' T'             MOVEA.L (A4),A0
  110.      36E: 20BC 000F 423F ' ...B?'         MOVE.L  #$F423F,(A0)
  111.      374: 2F0C           '/.'             PUSH.L  A4
  112.      376: 2F3C 6465 6D6F '/<demo'         PUSH.L  #'demo'
  113.      37C: 3F3C 0080      '?<..'           PUSH    #128
  114.      380: 487A 007C      30003FE          PEA     data209     ; len= 2
  115.      384: A9AB           '..'           _AddResource ; (theResource:Handle; theType:ResType; theID:INTEGER; name:Str255) 
  116.      386: 554F           'UO'             SUBQ    #2,A7
  117.      388: A9AF           '..'             _ResError ; :OSErr 
  118.      38A: 4A5F           'J_'             TST     (A7)+
  119.      38C: 6714           30003A2          BEQ.S   lih_1
  120.      38E: 3F3C 008B      '?<..'           PUSH    #139
  121.      392: 1F3C 0001      '.<..'           PUSH.B  #1
  122.      396: 4EAD 0462      2000B7C          JSR     DOSTANDA(A5)
  123.      39A: 554F           'UO'             SUBQ    #2,A7
  124.      39C: A9AF           '..'             _ResError ; :OSErr 
  125.      39E: 4EAD 0452      20009FE          JSR     DOERROR(A5)
  126.      3A2: 2F0C           '/.'    lih_1    PUSH.L  A4
  127.      3A4: A9AA           '..'             _ChangedResource ; (theResource:Handle) 
  128.      3A6: 2F0C           '/.'             PUSH.L  A4
  129.      3A8: A9B0           '..'             _WriteResource ; (theResource:Handle) 
  130.      3AA: 2F0C           '/.'             PUSH.L  A4
  131.      3AC: 4EAD 009A      100061E          JSR     HUnLock(A5)
  132.      3B0: 2F0C           '/.'    lih_2    PUSH.L  A4
  133.      3B2: 4EAD 0092      1000614          JSR     HLock(A5)
  134.      3B6: 2E3C 176F 7C4E '.<.o|N'         MOVE.L  #$176F7C4E,D7
  135.      3BC: 2054           ' T'             MOVEA.L (A4),A0
  136.      3BE: BE90           '..'             CMP.L   (A0),D7
  137.      3C0: 6606           30003C8          BNE.S   lih_3
  138.      3C2: 422D FDE2        -$21E          CLR.B   glob73(A5)
  139.      3C6: 6020           30003E8          BRA.S   lih_4
  140.      3C8: 554F           'UO'    lih_3    SUBQ    #2,A7
  141.      3CA: 2F07           '/.'             PUSH.L  D7
  142.      3CC: 4EBA FE68      3000236          JSR     DODEMODI
  143.      3D0: 1B5F FDE2        -$21E          POP.B   glob73(A5)
  144.      3D4: 102D FDE2        -$21E          MOVE.B  glob73(A5),D0
  145.      3D8: 5300           'S.'             SUBQ.B  #1,D0
  146.      3DA: 670C           30003E8          BEQ.S   lih_4
  147.      3DC: 2054           ' T'             MOVEA.L (A4),A0
  148.      3DE: 2087           ' .'             MOVE.L  D7,(A0)
  149.      3E0: 2F0C           '/.'             PUSH.L  A4
  150.      3E2: A9AA           '..'             _ChangedResource ; (theResource:Handle) 
  151.      3E4: 2F0C           '/.'             PUSH.L  A4
  152.      3E6: A9B0           '..'             _WriteResource ; (theResource:Handle) 
  153.      3E8: 2F0C           '/.'    lih_4    PUSH.L  A4
  154.      3EA: 4EAD 009A      100061E          JSR     HUnLock(A5)
  155.      3EE: 4CDF 1080      'L...'           MOVEM.L (A7)+,D7/A4
  156.      3F2: 4E5E           'N^'             UNLK    A6
  157.      3F4: 4E75           'Nu'             RTS     
  158.  
  159. Finder 7 Menus
  160.  
  161.  
  162.      458:                                 QUAL    GETPASSW ; b# =31  s#1  =proc14
  163.  
  164.                                  vap_1     VEQU  -288
  165.                                  vap_2     VEQU  -280
  166.                                  vap_3     VEQU  -276
  167.                                  vap_4     VEQU  -274
  168.                                  vap_5     VEQU  -272
  169.      458:                                 VEND    
  170.  
  171.                                ;-refs - DOCOMMAN  
  172.  
  173.      458: 4E56 FED8      'NV..'  GETPASSW LINK    A6,#-$128
  174.      45C: 48E7 0018      'H...'           MOVEM.L A3-A4,-(A7)
  175.      460: 4A2D FEFE        -$102          TST.B   glob59(A5)
  176.      464: 670C           1000472          BEQ.S   lap_1
  177.      466: 487A 01B4      100061C          PEA     data23      ; 'Password has already
  178.      46A: 4EBA 139E      100180A          JSR     OUTPUTTE
  179.      46E: 6000 00A2      1000512          BRA     lap_5
  180.      472: 3F2D FEBA        -$146 lap_1    PUSH    glob28(A5)
  181.      476: A998           '..'             _UseResFile ; (frefNum:RefNum) 
  182.      478: 594F           'YO'             SUBQ    #4,A7
  183.      47A: 3F3C 0101      '?<..'           PUSH    #257
  184.      47E: 42A7           'B.'             CLR.L   -(A7)
  185.      480: 70FF           'p.'             MOVEQ   #-1,D0
  186.      482: 2F00           '/.'             PUSH.L  D0
  187.      484: A97C           '.|'             _GetNewDialog ; (DlgID:INTEGER; wStorage:Ptr; behind:WindowPtr):DialogPtr 
  188.      486: 285F           '(_'             POP.L   A4
  189.      488: 2F0C           '/.'             PUSH.L  A4
  190.      48A: 3F3C 0002      '?<..'           PUSH    #2
  191.      48E: 486E FEEC      200FEEC          PEA     vap_3(A6)
  192.      492: 486E FEE8      200FEE8          PEA     vap_2(A6)
  193.      496: 486E FEE0      200FEE0          PEA     vap_1(A6)
  194.      49A: A98D           '..'           GetDItem ; (dlg:DialogPtr; itemNo:INTEGER; VAR kind:INTEGER; VAR item:Handle; VAR box:Rect) 
  195.      49C: 42A7           'B.'    lap_2    CLR.L   -(A7)
  196.      49E: 486E FEEE      200FEEE          PEA     vap_4(A6)
  197.      4A2: A991           '..'             _ModalDialog ; (filterProc:ProcPtr; VAR itemHit:INTEGER) 
  198.      4A4: 0C6E 0001 FEEE 200FEEE          CMPI    #1,vap_4(A6)
  199.      4AA: 66F0           100049C          BNE     lap_2
  200.      4AC: 2F2E FEE8      200FEE8          PUSH.L  vap_2(A6)
  201.      4B0: 486E FEF0      200FEF0          PEA     vap_5(A6)
  202.      4B4: A990           '..'             _GetIText ; (item:Handle; VAR text:Str255) 
  203.      4B6: 487A 0152      100060A          PEA     data22      ; 'cc5187efH28b911af'
  204.      4BA: 486E FEF0      200FEF0          PEA     vap_5(A6)
  205.      4BE: 4EBA FC4A      100010A          JSR     proc6
  206.      4C2: 6642           1000506          BNE.S   lap_3
  207.      4C4: 594F           'YO'             SUBQ    #4,A7
  208.      4C6: 486E FEF0      200FEF0          PEA     vap_5(A6)
  209.      4CA: A906           '..'             _NewString ; (theString:Str255):StringHandle 
  210.      4CC: 265F           '&_'             POP.L   A3
  211.      4CE: 2F0B           '/.'             PUSH.L  A3
  212.      4D0: 2F3C 5354 5220 '/<STR '         PUSH.L  #'STR '
  213.      4D6: 3F3C 0080      '?<..'           PUSH    #128
  214.      4DA: 487A 012C      1000608          PEA     data21      ; len= 2
  215.      4DE: A9AB           '..'             _AddResource ; (theResource:Handle; theType:ResType; theID:INTEGER; name:Str255) 
  216.      4E0: 3F2D FEBA        -$146          PUSH    glob28(A5)
  217.      4E4: A999           '..'             _UpdateResFile ; (frefNum:RefNum) 
  218.      4E6: 1B7C 0001 FEFE   -$102          MOVE.B  #1,glob59(A5)
  219.      4EC: 487A 00C0      10005AE          PEA     data20      ; 'Thanks for registeri
  220.      4F0: 4EBA 1318      100180A          JSR     OUTPUTTE
  221.      4F4: 4A2D FEFE        -$102          TST.B   glob59(A5)
  222.      4F8: 6714           100050E          BEQ.S   lap_4
  223.      4FA: 2F2D FEB0        -$150          PUSH.L  glob25(A5)
  224.      4FE: 487A 0086      1000586          PEA     data19      ; ''Thank you for payin
  225.      502: A91A           '..'             _SetWTitle ; (theWindow:WindowPtr; title:Str255) 
  226.      504: 6008           100050E          BRA.S   lap_4
  227.      506: 487A 001A      1000522 lap_3    PEA     data18      ; 'For only $10, you ca
  228.      50A: 4EBA 12FE      100180A          JSR     OUTPUTTE
  229.      50E: 2F0C           '/.'    lap_4    PUSH.L  A4
  230.      510: A982           '..'             _CloseDialog ; (dlg:DialogPtr) 
  231.      512: 4CDF 1800      'L...'  lap_5    MOVEM.L (A7)+,A3-A4
  232.      516: 4E5E           'N^'             UNLK    A6
  233.      518: 4E75           'Nu'             RTS     
  234.